package com.tianji.learning.controller;

import com.tianji.learning.domain.vo.SignResultVO;
import com.tianji.learning.service.SignRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *  签到记录相关接口
 */
@Api(tags = "签到记录相关接口")
@RestController
@RequestMapping("/sign-records")
public class SignRecordController {

    @Autowired
    private SignRecordService signRecordService;

    /**
     * 添加签到记录,到redis中以 bitMap的形式
     * @return 连续签到天数和今日签到获取的积分
     */
    @PostMapping
    @ApiOperation("添加签到记录")
    public SignResultVO saveSignRecord(){
        return signRecordService.saveSignRecord();
    }

    /**
     *  查询签到记录
     * @return 签到记录的byte数组
     */
    @GetMapping
    @ApiOperation("查询签到记录")
    public Byte[] getSignRecord(){
        return signRecordService.getSignRecord();
    }
}
